package com.util;

import java.text.DecimalFormat;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;

import com.entity.GoodsInfo;

public class PublicToolIndexProductShow {

	public static void typeInfo(HttpServletRequest request,
			HttpServletResponse response, ArrayList<GoodsInfo> productListShow,
			JspWriter out) {

		try {
			if (productListShow != null) {
				for (int i = 0; i < 4; i++) {
					GoodsInfo productShow = productListShow.get(i);

					if (PublicToolCheckParam.checkNullAndEmpty(productShow
							.getPhoto())) {
						out.println("imgUrl[" + i + "]='"
								+ productShow.getPhoto() + "';");
					} else {
						out.println("imgUrl[" + i
								+ "]='images/defaultpic.gif';");
					}

					out.println("imgLink[" + i + "]='servlet/ProductInfo?gid="
							+ productShow.getGoodsId() + "';");
					out.println("imgtext[" + i + "]='"
							+ productShow.getGoodsName() + "';");

				}
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
